package com.loren.tetris.data.entity;

import com.loren.tetris.data.constant.DataConstant;

import java.awt.*;

public class Block {

    private int x;

    private int y;

    private final int size;

    private final Color color;

    private final boolean frozen;

    public Block(int x, int y, Color color) {
        this(x, y, DataConstant.BLOCK_SIZE, color);
    }

    public Block(int x, int y, int size, Color color) {
        this(x, y, size, color, false);
    }

    public Block(int x, int y, Color color, boolean frozen) {
        this(x, y, DataConstant.BLOCK_SIZE, color, frozen);
    }

    public Block(int x, int y, int size, Color color, boolean frozen) {
        this.x = x;
        this.y = y;
        this.size = size;
        this.color = color;
        this.frozen = frozen;
    }

    public void setX(int x) {
        this.x = x;
    }

    public void setY(int y) {
        this.y = y;
    }

    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }

    public int getSize() {
        return size;
    }

    public Color getColor() {
        return color;
    }

    public boolean isFrozen() {
        return frozen;
    }

    public static Block blockFrozen(int x, int y) {
        return new Block(x, y, DataConstant.COLOR_BLOCK_FROZEN, true);
    }
}
